package qkyjson;

import org.antlr.v4.runtime.CharStream;
import org.antlr.v4.runtime.CharStreams;
import org.antlr.v4.runtime.CommonTokenStream;
import org.antlr.v4.runtime.tree.ParseTree;
import org.antlr.v4.runtime.tree.ParseTreeWalker;
import qkyjson.jsontest.JSONBaseListener;
import qkyjson.jsontest.JSONLexer;
import qkyjson.jsontest.JSONListener;
import qkyjson.jsontest.JSONParser;

public class Jsontest {
    public static void main(String[] args) {
        CharStream cs = CharStreams.fromString("{\"age\":0}");
        JSONLexer lexer = new JSONLexer(cs);
        System.out.println(lexer);
        CommonTokenStream tokens = new CommonTokenStream(lexer);
        System.out.println(tokens);
        JSONParser parser = new JSONParser(tokens);
        System.out.println(parser);


        ParseTree tree = parser.json();

        ParseTreeWalker walker = new ParseTreeWalker();

        JSONListener jsonListener = new JSONBaseListener();

        walker.walk(jsonListener, tree);
    }

}


